package day1105.second;

import day1105.common.MyUtil;
import day1105.common.Student;

import java.util.List;
import java.util.stream.Collectors;

import static day1105.common.MyUtil.printLine;

/**
 * @author Mr.ma
 * @since 2022/11/6 16:52
 **/
public class MapTest {
    public static void main(String[] args) {
        List<Student> studentList = MyUtil.createStudentList();
        studentList.stream().forEach(System.out::println);
        printLine("获取学生姓名");
        List<String> collect = studentList.stream().map(Student::getName).collect(Collectors.toList());
        System.out.println("collect = " + collect);
        printLine("学生年龄加一");
        studentList.stream().map(x -> {x.setAge(x.getAge() + 1); return x;})
                .forEach(System.out::println);
    }
}
